<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Peoples');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="people-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a(Yii::t('app', 'Create People'), ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            [
                'attribute' => 'id',
                'label'=>'对局',
                'format'=>'raw',
                'filter'=> false,
                'value' => function($model){
                    return Html::a("创建",['/game/create','uid'=>$model->id,],['class' => 'btn btn-success btn-xs'])
                        .Html::a("查询",['/game/index','SearchGame'=>['uid'=>$model->id]],['class' => 'btn btn-success btn-xs','style'=>'margin-left:5px'])
                        .Html::a("导出",['/people/export','uid'=>$model->id,],['class' => 'btn btn-success btn-xs','style'=>'margin-left:5px']);
                }
            ],
            [
                'attribute' => 'mobile',
                'format'=>'raw',
                'value' => function($model){
                    return Html::a($model->mobile,['/game/create','uid'=>$model->id]);
                }
            ],
            'nick_name',
            'real_name',
            // 'address',
            // 'mark',
            // 'create_at',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>
